import React, {Component} from 'react';
import RefButton from './RefButton';
import ComponentButton from './ComponentButton';

class ForwardingRef extends Component {
    constructor(props) {
        super(props);
        this.buttonRef = React.createRef();
    }

    render() {
        return (
            <>
                <RefButton ref={this.buttonRef}>Click me!</RefButton>
                <ComponentButton ref={this.buttonRef}>Click me!</ComponentButton>
            </>
        )
    }

    componentDidMount() {
        console.log('Did Mount:', this.buttonRef.current)
    }
}

export default ForwardingRef;